package need_learn.coding.haoweilai;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
/**
 * TODO 好未来， 获取最大拼接数 如：{9，77，78} 最大拼接数为 97877
 *
 * @author david
 * @version 1.0
 * @date 2021/4/20 14:56
 */
public class getBigJoinNum {
    public static void main(String[] args) {
        Scanner in =new Scanner(System.in);
        List<Integer> ints=new ArrayList<>();
        while (in.hasNextInt()){
            ints.add(in.nextInt());
        }
    }
    //获取
    public String MaxNum(String[] str) {
        for (int j = 0; j < str.length; j++) {
            for (int i = 0; i < str.length; i++) {
                if (this.compare(str[j], str[i])) {
                    String temp = str[j];
                    str[j] = str[i];
                    str[i] = temp;
                }
            }
        }
        StringBuilder num = new StringBuilder();
        for (String s : str) {
            num.append(s);
        }
        return num.toString();
    }

    public boolean compare(String str1, String str2) {

        int length = str1.length() + str2.length();
        String st = str1;
        str1 += str2;
        str2 += st;

        boolean flag = false;
        if (Integer.parseInt(str1.substring(0, length)) > Integer.parseInt(str2.substring(0, length))) {
            flag = true;
        }
        if (Integer.parseInt(str1.substring(0, length)) < Integer.parseInt(str2.substring(0, length))) {
            flag = false;
        }
        return flag;
    }
}
